#include <iostream>
#include <csignal>
#include <unistd.h>
#include <cstdlib>
#include <sys/types.h>

// ./mykill signum pid
int main(int argc, char* argv[]){
	if(argc != 3){
		std::cout<<"./mykill signum pid"<<std::endl;
		return 1;
	}
	
	int signum = atoi(argv[1]); 
	pid_t target = atoi(argv[2]);
	int n = kill(target, signum);
	if(n == 0){
		std::cout<<"send signal "<<signum<<" to process "<<target<<std::endl;
	}
	else if(n == -1){
		std::cout<<"kill failed"<<std::endl;
		return 1;
	}

	
	return 0;
}